package com.woldier.filesystem.service;


import com.woldier.base.exception.DoopfsException;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.Path;

import java.io.File;

public interface HdfsService {

   /**
   * @description 创建文件夹
   * @param path 路径名
   * @return void
   * @author: woldier
   * @date: 2023/3/23 14:57
   */
    void mkDir(String path);
    /**
    * @description 创建文件夹
     * @param path  路径文件
    * @return void
    * @author: woldier
    * @date: 2023/3/23 14:57
    */
    void mkDir(Path path);


    /**
    * @description 删除文件、文件夹
    * @param path 路径
    * @return boolean 成功返回true
    * @author: woldier
    * @date: 2023/3/23 14:59
    */
    boolean delete(String path) throws DoopfsException;
    /**
    * @description 删除文件、文件夹
    * @param Path  指定路径的文件
    * @return void
    * @author: woldier
    * @date: 2023/3/23 14:59
    */
    boolean delete(Path Path) throws DoopfsException;


    /**
    * @description 将本地文件拷贝到hadoop
    * @param localPath 本地文件路径
     * @param hadoopPath hadoop 文件路径
    * @return void
    * @author: woldier
    * @date: 2023/3/23 15:01
    */
    void upload(String localPath, String hadoopPath) throws DoopfsException;
    /**
    * @description 将本地文件拷贝到hadoop
    * @param localFile 本地文件
     * @param hadoopFile  hadoop文件
    * @return void
    * @author: woldier
    * @date: 2023/3/23 15:03
    */
    void upload(Path localFile, Path hadoopFile) throws DoopfsException;

    /**
    * @description 将hadoop文件下载到本地
    * @param hadoopPath hadoop文件路径
     * @param localPath  本地文件路径
    * @return void
    * @author: woldier
    * @date: 2023/3/23 15:06
    */
    void downLoad(String hadoopPath, String localPath) throws DoopfsException;
    /**
    * @description 将hadoop文件下载到本地
     * @param hadoopFile hadoop文件
     * @param localFile  本地文件
    * @return void
    * @author: woldier
    * @date: 2023/3/23 15:07
    */
    void downLoad(Path hadoopFile, Path localFile) throws DoopfsException;

    /**
    * @description 获取hadoop文件的流
    * @param hadoopPath  Hadoop文件路径
    * @return org.apache.hadoop.fs.FSDataInputStream
    * @author: woldier
    * @date: 2023/3/23 15:09
    */
    FSDataInputStream getHadoopFileStream(String hadoopPath) throws DoopfsException;
    /**
    * @description 获取hadoop文件的流
     * @param hadoopFile  Hadoop文件
    * @return org.apache.hadoop.fs.FSDataInputStream
    * @author: woldier
    * @date: 2023/3/23 15:09
    */
    FSDataInputStream getHadoopFileStream(Path hadoopFile) throws DoopfsException;


}
